home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / LINUX / MATH_EMU.ZIP / MATH_EMU / FRAME.H < prev    next >
Encoding:
C/C++ Source or Header  |  1979-12-31  |  5.8 KB  |  229 lines

  1. /*    $NetBSD: frame.h,v 1.10 1995/05/12 12:45:24 mycroft Exp $    */
  2.  
  3. /*
  4.  * Copyright (c) 1988 University of Utah.
  5.  * Copyright (c) 1982, 1990, 1993
  6.  *    The Regents of the University of California.  All rights reserved.
  7.  *
  8.  * This code is derived from software contributed to Berkeley by
  9.  * the Systems Programming Group of the University of Utah Computer
  10.  * Science Department.
  11.  *
  12.  * Redistribution and use in source and binary forms, with or without
  13.  * modification, are permitted provided that the following conditions
  14.  * are met:
  15.  * 1. Redistributions of source code must retain the above copyright
  16.  *    notice, this list of conditions and the following disclaimer.
  17.  * 2. Redistributions in binary form must reproduce the above copyright
  18.  *    notice, this list of conditions and the following disclaimer in the
  19.  *    documentation and/or other materials provided with the distribution.
  20.  * 3. All advertising materials mentioning features or use of this software
  21.  *    must display the following acknowledgement:
  22.  *    This product includes software developed by the University of
  23.  *    California, Berkeley and its contributors.
  24.  * 4. Neither the name of the University nor the names of its contributors
  25.  *    may be used to endorse or promote products derived from this software
  26.  *    without specific prior written permission.
  27.  *
  28.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  29.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  32.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  37.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  38.  * SUCH DAMAGE.
  39.  *
  40.  * from: Utah $Hdr: frame.h 1.8 92/12/20$
  41.  *
  42.  *    @(#)frame.h    8.1 (Berkeley) 6/10/93
  43.  */
  44.  
  45.  
  46. struct frame {
  47.     struct trapframe {
  48.         int    tf_regs[16];
  49.         short    tf_pad;
  50.         short    tf_stackadj;
  51.         u_short    tf_sr;
  52.         u_int    tf_pc;
  53.         u_short    tf_format:4,
  54.             tf_vector:12;
  55.     } F_t;
  56.     union F_u {
  57.         struct fmt2 {
  58.             u_int    f_iaddr;
  59.         } F_fmt2;
  60.  
  61.         struct fmt3 {
  62.             u_int    f_ea;
  63.         } F_fmt3;
  64.  
  65.         struct fmt7 {
  66.             u_int    f_ea;
  67.             u_short    f_ssw;
  68.             u_short    f_wb3s, f_wb2s, f_wb1s;
  69.             u_int    f_fa;
  70.             u_int    f_wb3a, f_wb3d;
  71.             u_int    f_wb2a, f_wb2d;
  72.             u_int    f_wb1a, f_wb1d;
  73. #define                f_pd0 f_wb1d
  74.             u_int    f_pd1, f_pd2, f_pd3;
  75.         } F_fmt7;
  76.  
  77.         struct fmt9 {
  78.             u_int    f_iaddr;
  79.             u_short    f_iregs[4];
  80.         } F_fmt9;
  81.  
  82.         struct fmtA {
  83.             u_short    f_ir0;
  84.             u_short    f_ssw;
  85.             u_short    f_ipsc;
  86.             u_short    f_ipsb;
  87.             u_int    f_dcfa;
  88.             u_short    f_ir1, f_ir2;
  89.             u_int    f_dob;
  90.             u_short    f_ir3, f_ir4;
  91.         } F_fmtA;
  92.  
  93.         struct fmtB {
  94.             u_short    f_ir0;
  95.             u_short    f_ssw;
  96.             u_short    f_ipsc;
  97.             u_short    f_ipsb;
  98.             u_int    f_dcfa;
  99.             u_short    f_ir1, f_ir2;
  100.             u_int    f_dob;
  101.             u_short    f_ir3, f_ir4;
  102.             u_short    f_ir5, f_ir6;
  103.             u_int    f_sba;
  104.             u_short    f_ir7, f_ir8;
  105.             u_int    f_dib;
  106.             u_short    f_iregs[22];
  107.         } F_fmtB;
  108.     } F_u;
  109. };
  110.  
  111. #define    f_regs        F_t.tf_regs
  112. #define    f_pad        F_t.tf_pad
  113. #define    f_stackadj    F_t.tf_stackadj
  114. #define    f_sr        F_t.tf_sr
  115. #define    f_pc        F_t.tf_pc
  116. #define    f_format    F_t.tf_format
  117. #define    f_vector    F_t.tf_vector
  118. #define    f_fmt2        F_u.F_fmt2
  119. #define    f_fmt3        F_u.F_fmt3
  120. #define    f_fmt7        F_u.F_fmt7
  121. #define    f_fmt9        F_u.F_fmt9
  122. #define    f_fmtA        F_u.F_fmtA
  123. #define    f_fmtB        F_u.F_fmtB
  124.  
  125. struct switchframe {
  126.     u_int    sf_pc;
  127. };
  128.  
  129. /* common frame size */
  130. #define    CFSIZE        (sizeof(struct frame) - sizeof(union F_u))
  131. #define    NFMTSIZE    8
  132.  
  133. #define    FMT0        0x0
  134. #define    FMT1        0x1
  135. #define    FMT2        0x2
  136. #define    FMT3        0x3
  137. #define    FMT7        0x7
  138. #define    FMT9        0x9
  139. #define    FMTA        0xA
  140. #define    FMTB        0xB
  141.  
  142. /* frame specific info sizes */
  143. #define    FMT0SIZE    0
  144. #define    FMT1SIZE    0
  145. #define    FMT2SIZE    sizeof(struct fmt2)
  146. #define    FMT3SIZE    sizeof(struct fmt3)
  147. #define    FMT7SIZE    sizeof(struct fmt7)
  148. #define    FMT9SIZE    sizeof(struct fmt9)
  149. #define    FMTASIZE    sizeof(struct fmtA)
  150. #define    FMTBSIZE    sizeof(struct fmtB)
  151.  
  152. #define    V_BUSERR    0x008
  153. #define    V_ADDRERR    0x00C
  154. #define    V_TRAP1        0x084
  155.  
  156. /* 68020/68030 SSW bits */
  157. #define    SSW_RC        0x2000
  158. #define    SSW_RB        0x1000
  159. #define    SSW_DF        0x0100
  160. #define    SSW_RM        0x0080
  161. #define    SSW_RW        0x0040
  162. #define    SSW_FCMASK    0x0007
  163.  
  164. /* 68040 SSW bits */
  165. #define    SSW4_CP        0x8000
  166. #define    SSW4_CU        0x4000
  167. #define    SSW4_CT        0x2000
  168. #define    SSW4_CM        0x1000
  169. #define    SSW4_MA        0x0800
  170. #define    SSW4_ATC    0x0400
  171. #define    SSW4_LK        0x0200
  172. #define    SSW4_RW        0x0100
  173. #define SSW4_WBSV    0x0080    /* really in WB status, not SSW */
  174. #define    SSW4_SZMASK    0x0060
  175. #define    SSW4_SZLW    0x0000
  176. #define    SSW4_SZB    0x0020
  177. #define    SSW4_SZW    0x0040
  178. #define    SSW4_SZLN    0x0060
  179. #define    SSW4_TTMASK    0x0018
  180. #define    SSW4_TTNOR    0x0000
  181. #define    SSW4_TTM16    0x0008
  182. #define    SSW4_TMMASK    0x0007
  183. #define    SSW4_TMDCP    0x0000
  184. #define    SSW4_TMUD    0x0001
  185. #define    SSW4_TMUC    0x0002
  186. #define    SSW4_TMKD    0x0005
  187. #define    SSW4_TMKC    0x0006
  188.  
  189. struct fpframe {
  190.     union FPF_u1 {
  191.         u_int    FPF_null;
  192.         struct {
  193.             u_char    FPF_version;
  194.             u_char    FPF_fsize;
  195.             u_short    FPF_res1;
  196.         } FPF_nonnull;
  197.     } FPF_u1;
  198.     union FPF_u2 {
  199.         struct fpidle {
  200.             u_short    fpf_ccr;
  201.             u_short    fpf_res2;
  202.             u_int    fpf_iregs1[8];
  203.             u_int    fpf_xops[3];
  204.             u_int    fpf_opreg;
  205.             u_int    fpf_biu;
  206.         } FPF_idle;
  207.  
  208.         struct fpbusy {
  209.             u_int    fpf_iregs[53];
  210.         } FPF_busy;
  211.  
  212.         struct fpunimp {
  213.             u_int    fpf_state[10];
  214.         } FPF_unimp;
  215.     } FPF_u2;
  216.     u_int    fpf_regs[8*3];
  217.     u_int    fpf_fpcr;
  218.     u_int    fpf_fpsr;
  219.     u_int    fpf_fpiar;
  220. };
  221.  
  222. #define fpf_null    FPF_u1.FPF_null
  223. #define fpf_version    FPF_u1.FPF_nonnull.FPF_version
  224. #define fpf_fsize    FPF_u1.FPF_nonnull.FPF_fsize
  225. #define fpf_res1    FPF_u1.FPF_nonnull.FPF_res1
  226. #define fpf_idle    FPF_u2.FPF_idle
  227. #define fpf_busy    FPF_u2.FPF_busy
  228. #define fpf_unimp    FPF_u2.FPF_unimp
  229.